<template>
	<view>
		<!-- 头像 -->
		<view class="top">
			<view class="user-img">
				<image :src="cover"></image>
			</view>
		</view>
		<!-- 详情页 -->
		<view class="menu">
			<view class="item" @click="toMyInfo">我的信息</view>
			<view class="item" @click="toMyResume">我的简历</view>
			<view class="item" @click="toSeeResume">查看简历</view>
			<view class="item" @click="toAboutUs">关于我们</view>
			<view class="item" @click="toLogOut">切换账号</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cover: ''
			}
		},
		onLoad() {
			uni.setNavigationBarColor({
				frontColor: "#000000",
				backgroundColor: '#00b4b3'
			});
			var isLogin = uni.getStorageSync("isLogin")
			if(isLogin!=this.$store.state.isLogin){
				this.$store.state.user = uni.getStorageSync("user");
				this.$store.state.isLogin = isLogin;
			}
			if (!this.$store.state.isLogin) {
				console.log("没登陆")
				this.$u.route('/pages/login/login')
			}
			// this.cover = this.$store.state.user.cover
			this.cover = uni.getStorageSync("user").cover;
		},
		onShow() {
			this.cover = uni.getStorageSync("user").cover;
			if (!this.$store.state.isLogin) {
				console.log("没登陆")
				uni.switchTab({
					url: '/pages/login/login'
				})
			}
		},
		methods: {
			toMyResume() {
				this.$u.route('/pages/myResume/myResume')
			},
			toAboutUs() {
				this.$u.route('/pages/aboutUs/aboutUs')
			},
			toMyInfo() {
				this.$u.route('/pages/myInfo/myInfo', {
					id: 0,
					user_id: this.$store.state.user._id
				})
			},
			toSeeResume(){
				this.$u.route('/pages/seeResume/seeResume', {
					id: 0,
					user_id: this.$store.state.user._id
				})
			},
			toLogOut() {
				// this.$u.route('/pages/index/index')
				// #ifdef H5
				location.reload()
				// #endif
				// #ifndef H5
				this.$u.route('/pages/login/login')
				// #endif
				this.$store.state.isLogin = false;
				// uni.removeStorageSync("Boss");
				// uni.removeStorageSync("isLogin");
				// uni.removeStorageSync("user");
				
				uni.clearStorageSync();
			}
		}
	}
</script>

<style lang="scss">
		page {
			background-image: url('https://s2.loli.net/2024/01/11/CQ3e1f2Nn5VWxab.png');
			// background-repeat: no-repeat;
			background-size:cover;
			// background-size: 100%;
		}
	
		.top {
			// background: $boss-base-color;
			background: #3A4861;
			width: 100%;
			padding: 30rpx 0;
		}
	
		.top .user-img {
			width: 252rpx;
			margin: 0 auto;
		}
	
		.top image {
			width: 252rpx;
			height: 252rpx;
			border-radius: 20%;
			border: 6rpx solid #777F92;
		}
	
		.menu .item {
			height: 96rpx;
			line-height: 96rpx;
			border-bottom: 2rpx solid #ccc;
			padding: 0 40rpx;
			font-size: 34rpx;
			text-align: center;
			
			// color: #cce7f8;
			// font-size: 2.5rem;
			// font-family: 'Pacifico', cursive;
			// text-transform: uppercase;
			// animation: shining 0.1s alternate infinite;
		}
		.menu .item:hover{
			height: 96rpx;
			line-height: 96rpx;
			border: 5rpx solid #ccc;
			padding: 0 40rpx;
			font-size: 40rpx;
			text-align: center;
			
			color: rgba(182, 211, 207, 0.9);
			// font-family: 'Pacifico', cursive;
			text-transform: uppercase;
			animation: shining 0.1s alternate infinite;
		}
</style>